#include<cstdio>
#include<cstring>
using namespace std;
int main(){
	
	char s[1000010];
	int off,ans=0,ans2=0,sum;
	scanf("%s",s);
	for(int i=0;i<=strlen(s);i++){
		if(off){
			if(s[i]=='('){
				int x=1;
				while(x){
				    i++;
					if(s[i]=='(') x++;
					else if(s[i]==')') x--;
					//i++;
				}
			}else if(off==1&&s[i]=='&'){
				ans++;
			}else if(off==2&&s[i]=='|'){
				ans2++;
			}else if(s[i]==')') {
				off=0;
			}else if(off==1&&s[i]=='|'){
				off=0;
			}
		}else{
			if(s[i]=='1') sum=1;
			else if(s[i]=='0') sum=0;
			if(sum==0&&s[i]=='&'){
				ans++;
				off=1;
			} 
			else if(sum==1&&s[i]=='|'){
				ans2++;
				off=2;
			} 
		}
	}
	printf("%d\n%d %d",sum,ans,ans2);
	
	return 0;
}